<template>
<div class="save-wrapper ui container">
    <div class="ui form  segment service-charge">
        <h3 class="ui header">设置手续费</h3>
        <div class="inline field">
            <label for="">支付宝信用卡支付手续费： <span v-show='!edit'>{{money}}%</span></label>
			<div class="ui right labeled input" v-show='edit'>
			  <input type="number" v-model="money"  placeholder="请输入手续费">
			  <div class="ui basic label">%</div>
			</div>
            <button class="ui button  mini icon circular" :class="{primary:edit}" @click.stop.prevent="submit()">
			{{edit?'提交':'编辑'}}
		  </button>
        </div>
    </div>
</div>
</template>
<script type="text/ecmascript-6">
import fselect from 'components/form/select'
import tool from 'src/util/tool';
import util from '_util/index';
import logic from '_logic';


export default {
    data() {
        return {
            money: '',
            edit: false
        }
    },
    methods: {
        submit() {
			if(this.edit){
				this.setServiceCharge()
			}else{
				this.edit = true;
			}
        },
        selServiceCharge() {
            util.http.getDataCom(this, '/index/Withdraw/selServiceCharge', {}, (rs) => {
				if(rs.value>0){
					this.money = rs.value
				}else{
					this.edit = true
				}
            })
        },
        setServiceCharge() {
            let param = {
                money: this.money
            };
            util.http.SR(this, '/index/Withdraw/setServiceCharge', param, '设置成功', (rs) => {
                this.edit = false
                this.selServiceCharge();
            });
        },
    },
    computed: {


    },
    components: {

    },
    created() {
        this.selServiceCharge()
    }
}
</script>
<style rel="stylesheet/less" scoped lang="less">
@import "../../common/style/mixin";
@dir: "edit/";
.circular {
    width: 60px;
    //margin-left: 10px;
}
.service-charge.ui.segment {
    margin-top: 20px;
    padding-top: 30px;
    padding-bottom: 50px;
}
form {
    .submitBtn();

}
</style>
